<% include ../../header.html  %>

<div class="col-sm-8">
    <form id="resourceForm" class="form-horizontal" action="/profile" enctype="multipart/form-data" >
        <input  name="id" value="<%=resource.id%>" type="hidden" >
        <input class="form-control" name="name" value="<%=resource.name%>" type="hidden">
        <div class="form-group ">
            <label  class="col-sm-2 control-label">资源简介</label>
            <div class="col-sm-10">
                <textarea class="form-control" rows="5" cols="20" name="brief" class="form-control" placeholder="请输入资源简介" required><%=resource.brief%></textarea>
            </div>
        </div>
        <div class="form-group ">
            <label  class="col-sm-2 control-label">资源文件</label>
            <div class="col-sm-4">
                <input class="form-control"  value="<%=resource.name%>" disabled>
            </div>
            <div class="col-sm-4">
                <input id="input-file" class="form-control" type="file" name="avatar" />
            </div>


        </div>

    </form>
    <div class="form-group">
        <div class="col-sm-11">
            <button id="download-content"  class="btn btn-success ar-toolbox-right"><strong>保存</strong>&nbsp;<i class="glyphicon glyphicon-save"></i></button>
        </div>
    </div>
</div>

<% include ../../footer.html  %>
<script type="text/javascript">

    $(document).ready(function(){
        $("#download-content").click(function(){
            $("#resourceForm").ajaxSubmit({
                type : "POST",
                processData : false,
                dataType:'text',
                success:function(data){
                    var data=JSON.parse(data);
                    layer.msg(data.msg, {
                        time: 2000 //20s后自动关闭
                    },function(){
                        window.location.reload();
                    });
                },
                error:function(error){
                    layer.msg(data.msg);
                }
            });
        });
    });

</script>